<template>
  <p>
    

  </p>
</template>

<script>
import { asyncnewAgent } from "../../../plugins/api.js";
export default {
  props: ["options", "usertypes"],
  data() {
    return {
      dialogFormVisible: false,
      formLabelWidth: "100px",
      form: {
        password: "",
        usertype: "Agent",
        username: "",
        useremail: "",
        phonenum: "",
        area: "0086",
        address: {},
        isnetwork: false
      },
      selectedOptions: []
    };
  },
  methods: {
    async onSubmit() {
      try {
        await asyncnewAgent(this.form);
        this.$store.dispatch("actionUser");
        this.$message({
          message: "恭喜你，添加成功",
          type: "success"
        });
        this.dialogFormVisible = false;
      } catch (err) {
        this.$message.error("错了哦，添加失败:" + err);
      }
    },
    address() {
      const address = window.address || [];
      return address;
    },
    handleChange() {
      const data = {
        province: this.selectedOptions[0],
        city: this.selectedOptions[1],
        area: this.selectedOptions[2]
      };
      this.form.address = data;
    }
  }
};
</script>

<style scoped>
p {
  display: inline-block;
}
</style>
